#include <iostream>
#include <string>
#include <vector>
#include <set>
using namespace std;

class Solution
{
public:
    bool isIsomorphic(string s, string t)
    {
        vector<int> map(256);
        set<char> set;
        for (int i = 0; i < s.size(); i++)
        {
            if (map[s[i]] == 0)
            {
                if (set.count(t[i]))
                    return false;
                set.insert(t[i]);
                map[s[i]] = t[i];
            }
            else
            {
                if (map[s[i]] != t[i])
                {
                    return false;
                }
            }
        }
        return true;
    }
};

int main()
{
    cout << "Code205" << endl;
    Solution s;
    cout << boolalpha << s.isIsomorphic("badc", "baba") << endl;
    return 0;
}